﻿using System.Windows;
using Microsoft.Surface.Presentation.Manipulations;

namespace Black.SurfaceToolkit.Controls
{
    /// <summary>
    /// Données pour les événements routés <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.InertiaDelta" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.ManipulationDelta" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterViewItem.AllOperationDelta" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.InertiaDelta" />, <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.ManipulationDelta" /> et <see cref="E:Black.SurfaceToolkit.Controls.CanvasScatterView.AllOperationDelta" />.
    /// </summary>
    public class OperationDeltaRoutedEventArgs : RoutedEventArgs
    {
        #region Accesseurs

        /// <summary>
        /// Retoune la vélocité angulaire.
        /// </summary>
        public double AngularVelocity
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient le cumul de l'expension.
        /// </summary>
        public double CumulativeExpansion
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient le cumul de rotation.
        /// </summary>
        public double CumulativeRotation
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient le cumul d'agrandissement.
        /// </summary>
        public double CumulativeScale
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient le cumul de déplacement.
        /// </summary>
        public Vector CumulativeTranslation
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la variation de déplacement.
        /// </summary>
        public Vector Delta
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la variation d'expension.
        /// </summary>
        public double ExpansionDelta
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la vélocité de l'expension.
        /// </summary>
        public double ExpansionVelocity
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient l'origine de la manipulation.
        /// </summary>
        public Point ManipulationOrigin
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la variation de rotation.
        /// </summary>
        public double RotationDelta
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la variation d'agrandissement.
        /// </summary>
        public double ScaleDelta
        {
            get;
            private set;
        }

        /// <summary>
        /// Obtient la vélocité.
        /// </summary>
        public Vector Velocity
        {
            get;
            private set;
        }

        #endregion

        #region Constructeurs

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationDeltaRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationDeltaRoutedEventArgs(Affine2DOperationDeltaEventArgs p_oOperation)
            : base()
        {
            this.InitializeInstance(p_oOperation);
        }

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationDeltaRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oEvent">Evénement routé associé.</param>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationDeltaRoutedEventArgs(RoutedEvent p_oEvent, Affine2DOperationDeltaEventArgs p_oOperation)
            : base(p_oEvent)
        {
            this.InitializeInstance(p_oOperation);
        }

        /// <summary>
        /// Initialise une nouvelle instance de <see cref="T:Black.SurfaceToolkit.Controls.OperationDeltaRoutedEventArgs" />.
        /// </summary>
        /// <param name="p_oEvent">Evénement routé associé.</param>
        /// <param name="p_oSource">Source de l'événement.</param>
        /// <param name="p_oOperation">Source d'information.</param>
        public OperationDeltaRoutedEventArgs(RoutedEvent p_oEvent, object p_oSource, Affine2DOperationDeltaEventArgs p_oOperation)
            : base(p_oEvent, p_oSource)
        {
            this.InitializeInstance(p_oOperation);
        }

        #endregion

        #region Fonctions privées

        /// <summary>
        /// Initialise l'instance à partir des informations spécifiées.
        /// </summary>
        /// <param name="p_oOperation">Source d'information.</param>
        private void InitializeInstance(Affine2DOperationDeltaEventArgs p_oOperation)
        {
            this.AngularVelocity = p_oOperation.AngularVelocity;
            this.CumulativeExpansion = p_oOperation.CumulativeExpansion;
            this.CumulativeRotation = p_oOperation.CumulativeRotation;
            this.CumulativeScale = p_oOperation.CumulativeScale;
            this.CumulativeTranslation = p_oOperation.CumulativeTranslation;
            this.Delta = p_oOperation.Delta;
            this.ExpansionDelta = p_oOperation.ExpansionDelta;
            this.ExpansionVelocity = p_oOperation.ExpansionVelocity;
            this.ManipulationOrigin = p_oOperation.ManipulationOrigin;
            this.RotationDelta = p_oOperation.RotationDelta;
            this.ScaleDelta = p_oOperation.ScaleDelta;
            this.Velocity = p_oOperation.Velocity;
        }

        #endregion
    }
}
